import request from '@/utils/request'
import type { PageResult } from '@/types'

export interface StudentRecord {
  id?: number
  studentId: number
  recordType: number
  content: string
  fileId?: number
  createUser?: number
  createTime?: string
}

/**
 * 分页查询档案记录
 */
export function getRecordPage(params: any) {
  return request<PageResult<StudentRecord>>({
    url: '/record/page',
    method: 'get',
    params
  })
}

/**
 * 获取学生所有档案记录
 */
export function getRecordByStudentId(studentId: number) {
  return request<StudentRecord[]>({
    url: `/record/student/${studentId}`,
    method: 'get'
  })
}

/**
 * 新增档案记录
 */
export function addRecord(data: StudentRecord) {
  return request<void>({
    url: '/record',
    method: 'post',
    data
  })
}

/**
 * 更新档案记录
 */
export function updateRecord(data: StudentRecord) {
  return request<void>({
    url: '/record',
    method: 'put',
    data
  })
}

/**
 * 删除档案记录
 */
export function deleteRecord(id: number) {
  return request<void>({
    url: `/record/${id}`,
    method: 'delete'
  })
}

